Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/split extension package #30

Merged
merged 55 commits into from
Nov 8, 2024
Merged

Feat/split extension package #30

merged 55 commits into from
Nov 8, 2024

Conversation

czhlin
Copy link
Contributor

@czhlin czhlin commented Sep 4, 2024

1.拆分wormhole包
2.拆出templates包
3.work改造

Copy link
Contributor

@JOU-amjs JOU-amjs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

一些修改建议我写在对应的代码处了,下面几点还需要再补充下的:

  1. wormhole里还需要用commander增加命令
  2. 子包的打包,vscode插件可以和之前一样用esbuild,wormhole就直接用tsc命令编译就行了,因为是node包,不需要再打包成一个文件。
  3. 建议templates子包可以作为一个文件夹合并到wormhole中。

.npmrc Outdated
recursive-install = true
# 使用淘宝镜像源
registry = https://registry.npmmirror.com
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个最好不用设置,到时我们配置github actions后是在github服务器上安装依赖的

package.json Outdated
"displayName": "Alova",
"description": "Generate and search APIs without API documentation any more",
"version": "0.0.10",
"description": "The devtools for alova.js",
Copy link
Contributor

@JOU-amjs JOU-amjs Sep 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个描述是我改的😂

"author": "",
"license": "ISC",
"dependencies": {
"@alova/templates": "workspace:^"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

templates这个子包我感觉可以直接放在wormhole里面,因为它只会用在这一个地方,而不是通用的或需要发布的

Comment on lines 6 to 7
"main": "src/index.ts",
"module": "src/index.ts",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里一般需要写编译之后的文件

"name": "@alova/wormhole",
"version": "1.0.0",
"description": "generate api for alova.js",
"homepage": "https://alova.js.org",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

还缺一个types指定这个包导出的函数对应的声明文件,这个声明文件一般是typings/index.d.ts(我现在都是这样做的,可以统一下)

export * from './generate';
export { default as Configuration } from './modules/Configuration';
export * from './readConfig';
export * from './type';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type类型不需要在这里导出,指定package.json下的types字段就可以了

Comment on lines 1 to 7
export * from './config';
export * from './createConfig';
export * from './functions/alovaJson';
export * from './functions/openApi2Data';
export * from './generate';
export { default as Configuration } from './modules/Configuration';
export * from './readConfig';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 这里不需要全部都对外暴露,我们只暴露几个预先说好的那几个函数就好了,其他的暴露后后面要改就比较麻烦了
  2. 对应的类型声明文件里也需要定义暴露的类型声明

@JOU-amjs JOU-amjs force-pushed the feat/split-extension-package branch from bfab345 to ea7076d Compare November 4, 2024 01:24
@JOU-amjs JOU-amjs merged commit add925a into main Nov 8, 2024
1 check passed
@JOU-amjs JOU-amjs mentioned this pull request Nov 8, 2024
@JOU-amjs JOU-amjs deleted the feat/split-extension-package branch November 26, 2024 04:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants